

<%@ page import="com.cgah.Listing" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'listing.label', default: 'Listing')}" />
        <title><g:message code="default.create.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav"><span class="spacer"></span>
            %{--<span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>--}%
            <sec:ifLoggedIn>
                <span class="menuButton"><g:link class="list" action="listingForUser">
                    <g:message code="default.my.listing.label" default="My Listings" ></g:message></g:link>
                </span>
            </sec:ifLoggedIn>
            <sec:ifNotLoggedIn>
                <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>
            </sec:ifNotLoggedIn>

        </div>
        <div class="body">
            <h1><g:message code="default.create.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${listingInstance}">
            <div class="errors">
                <g:renderErrors bean="${listingInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form action="save" >
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="name"><g:message code="listing.name.label" default="Name" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: listingInstance, field: 'name', 'errors')}">
                                    <g:textField name="name" maxlength="64" value="${listingInstance?.name}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="endDateTime"><g:message code="listing.endDateTime.label" default="End Date Time" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: listingInstance, field: 'endDateTime', 'errors')}">
                                    <g:datePicker name="endDateTime" precision="day" value="${listingInstance?.endDateTime}"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="startingBidPrice"><g:message code="listing.startingBidPrice.label" default="Starting Bid Price" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: listingInstance, field: 'startingBidPrice', 'errors')}">
                                    <g:textField name="startingBidPrice" value="${fieldValue(bean: listingInstance, field: 'startingBidPrice')}" />
                                </td>
                            </tr>
%{--
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="seller"><g:message code="listing.seller.label" default="Seller" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: listingInstance, field: 'seller', 'errors')}">
                                    <g:select name="seller.id" from="${com.cgah.Customer.list()}" optionKey="id" value="${listingInstance?.seller?.id}"  />
                                </td>
                            </tr>--}%
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="description"><g:message code="listing.description.label" default="Description" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: listingInstance, field: 'description', 'errors')}">
                                    <g:textArea name="description" cols="40" rows="5" value="${listingInstance?.description}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="winner"><g:message code="listing.winner.label" default="Winner" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: listingInstance, field: 'winner', 'errors')}">
                                    <g:select name="winner.id" from="${com.cgah.Customer.list()}" optionKey="id" value="${listingInstance?.winner?.id}" noSelection="['null': '']" />
                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
